<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <style>
      .kuang {
        text-align: center;
        margin-top: 200px;
      }
      #mess {
        text-align: center;
      }
    </style>
  </head>
  <body>
    <div id="mess"></div>

    <script type="text/javascript" src="src/swfobject.js"></script>
    <script type="text/javascript" src="src/web_socket.js"></script>

    <script>
      var mess = document.getElementById("mess");
      WEB_SOCKET_SWF_LOCATION = "WebSocketMain.swf";
      var ws = new WebSocket("ws://10.82.0.15:843");

      ws.onopen = function(e) {
        console.log("连接服务器成功");
        ws.send("game2");
      };
      ws.onclose = function(e) {
        console.log("服务器关闭");
      };
      ws.onerror = function() {
        console.log("连接出错");
      };

      ws.onmessage = function(e) {
        var time = new Date();
        mess.innerHTML += time + "的消息：" + e.data + "<br>";
      };
    </script>
  </body>
</html>
